package com.java.control.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;

import com.java.control.AbstractAdminCommandController;
import com.java.control.search.SearchStat;
import com.java.control.search.SupplierQuotationSearchCond;
import com.java.entity.SupplierQuotation;
import com.java.service.SupplierQuotationService;

/**
 * 供应商产品报价管理
 * @author wqf
 * @version  Nov 24, 2011 12:00:53 PM
 */
public class SupplierQuotationListController extends AbstractAdminCommandController {

	public SupplierQuotationListController(){
		this.setCommandClass(SupplierQuotationSearchCond.class);
	}	

	protected ModelAndView executeRequest(HttpServletRequest request,HttpServletResponse response,Object command)
		throws Exception{
		
		SupplierQuotationSearchCond searchCond = (SupplierQuotationSearchCond)command;
		
		ModelAndView mav=new ModelAndView(this.view);
		searchCond.setPageSize(10L);
		SearchStat searchStat = this.supplierQuotationService.getSearchStat(SupplierQuotation.class, searchCond);
		List<SupplierQuotation> List = this.supplierQuotationService.search(SupplierQuotation.class,searchCond);
		mav.addObject("searchStat", searchStat);
		mav.addObject("searchCond", searchCond);
		mav.addObject("supplierQuotationList", List);		
				
		return mav;
		
	}
		
	private String view;
	private SupplierQuotationService supplierQuotationService;
	
	public void setSupplierQuotationService(
			SupplierQuotationService supplierQuotationService) {
		this.supplierQuotationService = supplierQuotationService;
	}

	public void setView(String view) {
		this.view = view;
	}

}
